<!DOCTYPE HTML>
<html>
<%@page language="java" pageEncoding="UTF-8"%>
<%@taglib uri="/tags/jstl-fmt" prefix="fmt"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@page import="com.fooddiary.util.AppConstants" %>
<%@page import="com.fooddiary.web.AbstractController" %>
<head>
	<title><fmt:message key="label.application.title"></fmt:message> </title>
	<link rel="stylesheet" type="text/css" href="<%=request.getContextPath()%>/resources/css/print.css" />
	<script type="text/javascript" src="<%=request.getContextPath()%>/resources/js/lib/jquery-1.7.1.js"></script>
</head>
<body>
	<div class="header">
		<a href="<%=request.getContextPath()+"/j_spring_security_logout"%>" id="button_logout" class="form-button form-button-logout">
			<fmt:message key="button.logout"></fmt:message>
		</a>
		<a href="<%=request.getContextPath()+"/private/model/main.action"%>" id="button_main" class="form-button form-button-goto-main">
			<fmt:message key="button.goto.main.page"></fmt:message>
		</a>
		<div class="header_title">
			<fmt:message key="label.application.title"></fmt:message>
		</div>
	</div>
	<table>
		<c:if test="${not empty weights}">
			<c:forEach var="weight" items="${weights}">
				<tr>
					<td class="column-date">
						<fmt:message key="label.date"/>
						<span class="datetime">${weight.date}</span>
					</td>
					<td class="column-weight">
						<fmt:message key="label.weight.kg"/>
						<span class="weight">${weight.weight}</span>
					</td>
					<td>
						<fmt:message key="label.weight.diff.kg"/>
						<fmt:message key="label.day"/>
						<c:choose>
							<c:when test="${weight.dayDifference > 0}">
								<span class="overweight">${weight.dayDifference}</span>
							</c:when>
							<c:otherwise>
								<span class="underweight">${weight.dayDifference}</span>
							</c:otherwise>
						</c:choose>			
						<fmt:message key="label.week"/>
						<c:choose>
							<c:when test="${weight.weekDifference > 0}">
								<span class="overweight">${weight.weekDifference}</span>
							</c:when>
							<c:otherwise>
								<span class="underweight">${weight.weekDifference}</span>
							</c:otherwise>
						</c:choose>
						<fmt:message key="label.month"/>
						<c:choose>
							<c:when test="${weight.monthDifference > 0}">
								<span class="overweight">${weight.monthDifference}</span>
							</c:when>
							<c:otherwise>
								<span class="underweight">${weight.monthDifference}</span>
							</c:otherwise>
						</c:choose>			
					</td>
					<td class="column-trening">
						<c:if test="${weight.trenning == true}">
							<div class="trenning">
								<fmt:message key="label.sport.lesson"/>
							</div>
						</c:if>
					</td>									
				</tr>
				<tr>
					<td colspan="4" class="column-eating">
						<c:if test="${not empty weight.eatings}">
							<ul>
							<c:forEach var="eating" items="${weight.eatings}">
								<c:if test="${eating.food.length() > 0}">
								<li>
									<c:choose>
									<c:when test="${eating.overweight == true}">
										<span class="overweight">${eating.eatingType.displayName}</span>
									</c:when>
									<c:otherwise>
										<span class="underweight">${eating.eatingType.displayName}</span>
									</c:otherwise>
									</c:choose>
									: <span class="datetime">${eating.time}</span> 
									<span>${eating.food}</span>
								</li>
								</c:if>
							</c:forEach>
							</ul>
						</c:if>				
					</td>
				<tr>
			</c:forEach>
		</c:if>	
	</table>													
</body>
<script type="text/javascript">
$(document).ready(function(){
	$('#button_logout').css('display', 'block');
	$('#button_main').css('display', 'block');
	window.print();
});
</script>
</html>